Central Article

Using the Central Accordion Tab Component


Table of Contents

  1. Introduction
  2. Getting Started
  3. Adding Tabs to the Accordion Tab Component
  4. Determining When the User Selects a Tab
  5. Switching Between Views When the Selected Tab Changes
  6. Using the Accordion Tab Component for Application Layout
  7. Adding Favorite Tab Support
  8. Additional Resources

Using the Accordion Tab Component for Application Layout

The Accordion Tab component creates a beveled box that contains tabs at the top. However, if you do not add any tabs to the component, a beveled box is still created. This can be used as a background graphic to help delineate different sections of your application (see Figure 5).

Use of the Accordion Tab component for tabs and layout in the Active Content Resource application

Figure 5. Use of the Accordion Tab component for tabs and layout in the Active Content Resource application

This technique is as easy as dragging the component into your application and sizing it. This creates a beveled box in the default color.

For this example, go ahead and change the color using the setBaseColor function of the component.

Here is the code for the example:

function onActivate()
{
	frameCount = 0;
	
	onEnterFrame = function()
	{
			if(frameCount < 1)
			{
				frameCount++;
				return;
			}
	
			myTab.setBaseColor(0x003366);
	
			delete frameCount;
			delete onEnterFrame;
	}
}

Central.initApplication(this, this);

This creates within the application the beveled box shown in Figure 6.

Using the Accordion Tab component to create a beveled box

Figure 6. Using the Accordion Tab component to create a beveled box

However, that seems like a lot of code to just set the color. Unfortunately, it is necessary due to an issue with the component. You must wait a frame before you can call methods on it that affects its appearance. The code above basically waits a frame after the component has loaded to call the setBaseColor method.

If you test the example, you can actually see the component change colors, which is not good. The workaround is to set the color at author time using the Property Inspector (see Figure 7).

Setting the Accordion Tab color in the Property Inspector

Figure 7. Setting the Accordion Tab color in the Property Inspector